﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UI
{
    public partial class Add_Edit_Variable : Form
    {
        public Add_Edit_Variable()
        {
            InitializeComponent();
        }

        
        
        public Add_Edit_Variable(string name,string description,string InitialValue )
        {
            InitializeComponent();
            txtBox_Name_Variable.Text = name;
            txtBox_Description_Variable.Text = description;
            txtBox_InitialValue_Variable.Text = InitialValue;
        }

        private void btn_Save_Variable_Click(object sender, EventArgs e)
        {
            MainForm_EventHandler.DeleteVariable(MainForm.selectedRow+1);
            MainForm_EventHandler.AddVariable(txtBox_Name_Variable.Text.ToString(),
                                              txtBox_Description_Variable.Text.ToString(),
                                              txtBox_InitialValue_Variable.Text.ToString());
                
           
                
            txtBox_Name_Variable.Clear();
            txtBox_InitialValue_Variable.Clear();
            txtBox_Description_Variable.Clear();
        }

        private void btn_CancelAdd_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
